<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="com.mg.service.UserService" %>
<%@ page import="com.mg.model.User" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="../../common/taglibs.jsp" %>
<%@ include file="../../common/head.builive.inc.jsp" %>
<%@ include file="../../common/session.script.inc.jsp" %>
<html>
<head>
    <title>用户中心</title>
</head>
<%
    WebApplicationContext context = (WebApplicationContext) request.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    UserService userService = (UserService) context.getBean("userServiceImpl");
    User user = (User) request.getSession().getAttribute(Constants.USER_INFO);
    user = userService.getUser(user.getId());
    String type = "现金收益";
    if ("E".equals(user.getRevenueType())) {
        type = "ETH收益";
    }
    BigDecimal electricityFee = BigDecimal.valueOf(0).subtract(user.getElectricityFee());
%>
<link rel="stylesheet" type="text/css" href="${ctx}/pages/user/css/userCenter.css">
<body>
<div class="doc-content" style="float:left;width: 40%;height: 370px">
    <div class="panel" style="margin: 10px 5px;height: 370px ">
        <div class="panel-header">
            <h3>基本信息</h3>
        </div>
        <div class="panel-body">
            <form id="infoForm" class="form-horizontal form-info">
                <div class="row baseInfo">
                    <div class="control-group span11">
                        <label class="control-label"><b>UID：</b></label>
                        <label class="control-label" style="text-align: left" id="userId"></label>
                        <a href="${ctx}/pages/user/userInfo.jsp" class="userInfo"></a>
                    </div>
                    <div class="control-group span11">
                        <label class="control-label"><b>姓名：</b></label>
                        <label class="control-label" style="text-align: left" id="userName"></label>
                    </div>
                    <div class="control-group span11">
                        <label class="control-label"><b>手机号：</b></label>
                        <label class="control-label" style="text-align: left" id="phoneNumber"></label>
                    </div>
                    <div class="control-group span11">
                        <label class="control-label"><b>收益类型：</b></label>
                        <label class="control-label" style="text-align: left;width: 200px"><%=type%> &nbsp; <button  type="button" class=" editRevenueType button button-success">修改</button></label>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="doc-content" style="float:right;width: 60%;">
    <div style="text-align: center;margin-top: 10px;">
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-left: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>有效算力（MB/s）</h3>
                    <div class="computingPower" style="margin-top: 5px;margin-bottom: 10px;"></div>
                    <a href="#" class="button button-primary button-size " id="buyBtn">购买算力</a>
                </div>
            </div>
        </div>
        <div style="float:left;width: 34%;">
            <div class="panel" style="margin-left: 5px;margin-right: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>昨日收益（CNY）</h3>
                    <div class="amount" style="margin-top: 5px;margin-bottom: 10px;"></div>
                    <a href="#" class="button button-primary  button-size " id="searchProfitBtn">查看全部收益</a>
                </div>
            </div>
        </div>
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-right: 5px">
                <div class="panel-body" style="text-align: center">
                    <h3>可用余额（CNY）</h3>
                    <div class="balance" style="margin-top: 5px;margin-bottom: 10px;"><%=user.getBalance()%>元</div>
                    <div>
                        <a href="#" class="button button-primary balanceHandler  button-size ">充值</a>
                        <a href="#" class="button balanceHandler  button-size ">提现</a>
                    </div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-left: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>冻结算力（MB/s）</h3>
                    <div class="frozenComputingPower" style="margin-top: 5px;margin-bottom: 10px;"></div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 34%;">
            <div class="panel" style="margin-left: 5px;margin-right: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>累计总收益（CNY）</h3>
                    <div class="profit" style="margin-top: 5px;margin-bottom: 10px;"></div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-right: 5px">
                <div class="panel-body" style="text-align: center">
                    <h3>累计冻结资金（CNY）</h3>
                    <div class="frozeMoney" style="margin-top: 5px;margin-bottom: 10px;"></div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-left: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>昨日ETH收益/累计ETH总收益</h3>
                    <div class="ethAmount" style="margin-top: 5px;margin-bottom: 10px;"></div>
                    <div class="ethProfit" style="margin-top: 5px;margin-bottom: 10px;"></div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 34%;">
            <div class="panel" style="margin-left: 5px;margin-right: 5px;">
                <div class="panel-body" style="text-align: center">
                    <h3>ETH余额/ETH冻结</h3>
                    <div class="ethBalance"
                         style="margin-top: 5px;margin-bottom: 10px;"><%=user.getEthBalance().toPlainString()%>
                    </div>
                    <div class="ethfrozeMoney"
                         style="margin-top: 5px;margin-bottom: 10px;"><%=user.getEthFrozeMoney().toPlainString()%>
                    </div>
                </div>
            </div>
        </div>
        <div style="float:left;width: 33%;">
            <div class="panel" style="margin-right: 5px">
                <div class="panel-body" style="text-align: center">
                    <h3>电费（CNY）</h3>
                    <div class="electricityFee" style="margin-top: 5px;margin-bottom: 10px;">
                        &nbsp;
                    </div>
                    <div class="electricityFee" style="margin-top: 5px;margin-bottom: 10px;">
                        <%=electricityFee%>元
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div style="float:left;width: 100%;">
    <div id="tab" style="margin: 0px 5px 0px 5px;">
        <ul>
            <li class="bui-tab-panel-item active">
                <a onclick="tabMenuClick(0);">合约记录</a>
            </li>
            <li class="bui-tab-panel-item">
                <a onclick="tabMenuClick(1);">收益记录</a>
            </li>
            <li class="bui-tab-panel-item">
                <a onclick="tabMenuClick(2);">充值记录</a>
            </li>
            <li class="bui-tab-panel-item">
                <a onclick="tabMenuClick(3);">提现记录</a>
            </li>
        </ul>
    </div>
</div>
<div style="float:left;width: 100%;">
    <div id="fileList" style="margin: -1px 5px 5px 5px;">
        <div id="contListGrid"></div>
        <div id="revenueListGrid" style="display: none"></div>
        <div id="rechargeGrid" style="display: none"></div>
        <div id="presentGrid" style="display: none"></div>
    </div>
</div>
<div style="float:left;width: 100%;display: none">
    <div class="doc-content" style="float:left;width: 50%;">
        <div class="panel" style="margin: 10px 5px;">
            <div class="panel-header">
                <span style="font-size: 16px">矿场实时数据（正在挖BTC）</span>
                <span style="font-size: 12px;margin-left: 20px;">数据同步时间：</span>
            </div>
            <div class="panel-body">
            </div>
        </div>
    </div>
    <div class="doc-content" style="float:left;width: 50%;">
        <div class="panel" style="margin: 10px 5px;">
            <div class="panel-body">
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="${ctx}/pages/user/js/userCenter.js"></script>
</body>
</html>